/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tabelamodelcolumnmodel.obrigacoes;

import tabelamodelcolumnmodel.cliente.*;
import eloma.classe.Cliente;
import eloma.classe.obrigacoes.VersaoSpedFiscal;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Icaro
 */
public class VersaoSpedFiscalTableModel extends AbstractTableModel {

    private List<VersaoSpedFiscal> listVersao;
    private boolean ordenarPorNome = true;

    public VersaoSpedFiscalTableModel(List<VersaoSpedFiscal> listVersao) {
        this.listVersao = listVersao;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        VersaoSpedFiscal ver = listVersao.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return ver.getVersao();
            case 1:
                return ver.getDescricao();
            case 2:
                return ver.getDataValidade();
        }

        return null;
    }

    @Override
    public int getRowCount() {
        return listVersao.size();
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    public VersaoSpedFiscal getValoresCliente(int rowIndex) {
        return listVersao.get(rowIndex);
    }

    public boolean isOrdenarPorNome() {
        return ordenarPorNome;
    }

    public void setOrdenarPorNome(boolean ordenarPorNome) {
        this.ordenarPorNome = ordenarPorNome;
    }

}
